package com.bancomer.batch.util;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;

public class FilesReader {
	public static StringBuffer readFile(String path) throws Exception{
		StringBuffer bufferFile = new StringBuffer();
		FileReader fileReader = new FileReader(path);
		BufferedReader buffer = new BufferedReader(fileReader);
		String line = buffer.readLine();
		while(line!=null){
			bufferFile.append(line+"\n");
			line = buffer.readLine();
		}
		int indexEndOfLine = bufferFile.lastIndexOf("\n");
		bufferFile.deleteCharAt(indexEndOfLine);
		//bufferFile.delete(indexEndOfLine,bufferFile.length());
		buffer.close();
		return bufferFile;
	}
}
